//
//  MoreFirstCell.swift
//  SwiftOfXiaoShouJia
//
//  Created by zhenjingxiong on 2018/9/5.
//  Copyright © 2018年 镇景雄. All rights reserved.
//

import UIKit

class MoreFirstCell: UITableViewCell {

    override func awakeFromNib() {
        super.awakeFromNib()
        
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.layoutUI()
    }
    
    func layoutUI() {
        self.selectionStyle = UITableViewCellSelectionStyle.none
        self.addSubview(self.iconImageView)
        self.iconImageView.snp.makeConstraints { (make) in
            make.left.equalTo(15)
            make.centerY.equalTo(self.snp.centerY)
        }
        
        //添加姓名
        self.addSubview(self.nameLabel)
        self.nameLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.iconImageView.snp.right).offset(20)
            make.top.equalTo(self.iconImageView.snp.top)
        }
        
        
        //电话中心
        self.addSubview(self.CallCenterLabel)
        self.CallCenterLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.nameLabel.snp.left)
            make.top.equalTo(self.nameLabel.snp.bottom).offset(10)
        }
        
        //置业顾问
        self.addSubview(self.consultantLabel)
        self.consultantLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.nameLabel.snp.right).offset(10)
            make.centerY.equalTo(self.nameLabel.snp.centerY)
            make.width.equalTo(50)
            make.height.equalTo(18)
        }
        
        self.consultantLabel.layer.masksToBounds = true
        self.consultantLabel.layer.cornerRadius = 3
        
        //电话号码
        self.addSubview(self.phoneNumberLabel)
        self.phoneNumberLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.CallCenterLabel.snp.right).offset(20)
            make.centerY.equalTo(self.CallCenterLabel.snp.centerY)
        }
        
        //添加箭头
        self.addSubview(self.arrowImageView)
        self.arrowImageView.snp.makeConstraints { (make) in
            make.centerY.equalTo(self)
            make.right.equalTo(self).offset(-20)
        }
        
    }
    
    
    lazy var iconImageView: UIImageView = {
        let iconImageView = UIImageView.init(image: UIImage.init(named: "avatar_default"))
        return iconImageView
    }()
    
    
    lazy var nameLabel: UILabel = {
        let nameLabel = UILabel.init()
        nameLabel.text = "镇景雄"
        nameLabel.font = UIFont.systemFont(ofSize: 16)
        return nameLabel
    }()
    
    lazy var CallCenterLabel: UILabel = {
        let CallCenterLabel = UILabel.init()
        CallCenterLabel.text = "电话中心"
        CallCenterLabel.font = UIFont.systemFont(ofSize: 12)
        CallCenterLabel.textColor = UIColor.gray
        return CallCenterLabel
    }()
    
    lazy var consultantLabel: UILabel = {
        let consultantLabel = UILabel.init()
        consultantLabel.text = "置业顾问"
        consultantLabel.textColor = UIColor.red
        consultantLabel.font = UIFont.systemFont(ofSize: 10)
        consultantLabel.layerWithView(color: UIColor.red, WithRadius: 2, WithBorder: 1)
        consultantLabel.textAlignment = NSTextAlignment.center
        return consultantLabel
    }()
    
    lazy var phoneNumberLabel: UILabel = {
        let phoneNumberLabel = UILabel.init()
        phoneNumberLabel.font = UIFont.systemFont(ofSize: 12)
        phoneNumberLabel.textColor = UIColor.gray
        phoneNumberLabel.text = "18923417026"
        return phoneNumberLabel
    }()
    
    lazy var arrowImageView: UIImageView = {
        let arrowImageView = UIImageView.init(image: UIImage.init(named: "icon_arrow"))
        return arrowImageView
    }()
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
